﻿@model PagingDataSet<User>
@{
    Layout = "app-list-2cols";
    Html.IncludeCss("~/Applications/Bar/Styles/app.css", ResourceRenderPriority.Last);
    Html.IncludeScript("~/Applications/Bar/Scripts/jquery.spb.bar.js", ResourceRenderPriority.Last);
    var barSection = ViewData.Get<BarSection>("barSection", new BarSection());
}
@section ContentHeader{
    @Html.Action("_BarSubmenu", "Bar")
}
@section Aside{
    @Html.Action("_TopSections", "Bar", new { topNumber = 6, sortBy = SortBy_BarSection.ThreadAndPostCount, displayTemplate = DisplayTemplate_TopSections.Headline })
}
<div class="tn-box tn-widget tn-widget-content tn-corner-all spb-bar-mambers">
    <div class="tn-box-content tn-widget-content tn-corner-all">
        <div class="tn-main-heading">
            <h2>
                关注本吧的用户</h2>
        </div>
        <div class="tn-tabs">
            <ul class="tn-tabs-nav tn-border-gray tn-border-bottom tn-helper-clearfix">
                <li class="tn-widget-content tn-border-gray tn-border-trl tn-tabs-selected"><a href="@SiteUrls.Instance().SectionMembers(barSection.SectionId)">全部</a> </li>
                <li class="tn-widget-content tn-border-gray tn-border-trl"><a href="@SiteUrls.Instance().MyFollowedUsersForSection(barSection.SectionId)">我关注的人</a></li>
            </ul>
            <div class="tn-tabs-panel">               
                @if (barSection.SectionManagers != null && barSection.SectionManagers.Count() > 0)
                { <div class="tn-content-heading tn-border-gray tn-border-bottom">
                    <h4>
                        帖吧管理员</h4>
                </div>
                    <ul class="tn-avatar-list tnc-person-flow tn-helper-clearfix">
                        @if (barSection.User != null)
                        { 
                            <li class="tn-avatar-item">
                                @Html.ShowUserAvatar(barSection.User, SiteUrls.Instance().UserThreads(barSection.UserId), AvatarSizeType.Small, HyperLinkTarget._blank)
                                <a href="@SiteUrls.Instance().UserThreads(barSection.UserId)" title="@barSection.User.DisplayName" class="tn-user-name">@barSection.User.DisplayName</a> <span class="tn-icon-colorful tn-icon-colorful-manager tn-icon-inline" title="吧主"></span></li>                   
                        }
                        @foreach (var manager in barSection.SectionManagers)
                        {
                            <li class="tn-avatar-item tn-hover" id="manager_@(manager.UserId)">
                                @Html.ShowUserAvatar(manager, SiteUrls.Instance().UserThreads(manager.UserId), AvatarSizeType.Small, HyperLinkTarget._blank)
                                <a href="@SiteUrls.Instance().UserThreads(manager.UserId)" title="@manager.DisplayName" class="tn-user-name">@manager.DisplayName</a>
                                @if (new Authorizer().BarSection_SetManager(barSection))
                                { 
                                    @Html.AjaxDeleteButton(new AjaxDeleteButton()
                                    .SetConfirm("确定要删除此管理员？")
                                    .SetText("<span class=\"tn-icon tn-icon tn-smallicon-cross\"></span>")
                                    .SetUrl(SiteUrls.Instance().DeleteManager(barSection.SectionId, manager.UserId))
                                    .MergeHtmlAttribute("class", "tn-delete tn-state-hidden tn-in-pic")
                                    .MergeHtmlAttribute("title", "删除管理员")
                                    .MergeHtmlAttribute("name", "operate_" + manager.UserId)
                                    .SetDeleteTarget("#manager_" + manager.UserId))
                                }
                            </li>
                        }
                    </ul>
                }
                <div class="tn-content-heading tn-border-gray tn-border-bottom">
                    <h4>
                        帖吧成员</h4>
                </div>
                @if (Model != null && Model.Count() > 0)
                { <ul class="tn-avatar-list">
                    @foreach (var user in Model)
                    {
                        <li class="tn-avatar-item">
                            @Html.ShowUserAvatar(user, SiteUrls.Instance().UserThreads(user.UserId), AvatarSizeType.Small, HyperLinkTarget._blank)
                            <a href="@SiteUrls.Instance().UserThreads(user.UserId)" title="@user.DisplayName" class="tn-user-name">@user.DisplayName</a> </li>                                            
                    }
                </ul>
                    <div class="tn-pagination">
                        @Html.PagingButton(Model)
                    </div>
                }
                else
                { 
                    <div class="tn-no-data">
                        暂无成员</div>
                }
            </div>
        </div>
    </div>
</div>
